package com.aspose.cells.a.d.a;

import java.io.IOException;
import java.io.OutputStream;

public class zh extends za {
   protected zi c;
   int d = 0;

   public zh(OutputStream var1, int var2) {
      super(var1, true);
      this.c = new zi(var2);
   }

   protected void a(int var1, long var2) throws IOException {
      this.a((long)var1);
      this.a(var2 + 8L);
   }

   public void a(zg var1) {
      ++this.d;
      int var2 = var1.a();
      if (!this.c.a(var2)) {
         throw new RuntimeException(var2 + " is a invalid tagID.");
      } else {
         this.a(true);

         try {
            var1.a(var2, this);
            int var3 = this.f();
            int var4 = (var3 - this.b() % var3) % var3;

            int var5;
            for(var5 = 0; var5 < var4; ++var5) {
               this.write(0);
            }

            var5 = this.b();
            this.a(false);
            this.a(var2, (long)var5);
            this.a();
         } catch (Exception var6) {
            throw new RuntimeException(var6);
         }
      }
   }

   public int g() {
      return this.d;
   }
}
